package com.yinghuo.risk.frigate.web.bean.base;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * com.yinghuo.risk.frigate.core.bean.base
 *
 * @author 白雨浓
 * date: 2018/10/17 9:55
 * content:
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ResultBean {

    private boolean success = true;

    private Long token = System.currentTimeMillis();

    private LocalDateTime start = LocalDateTime.now();

    private LocalDateTime end = LocalDateTime.now();

    private String msg;

    private Object data;


    public static ResultBean success(Object data) {
        ResultBean bean = new ResultBean();
        bean.setData(data);
        return bean;
    }

    public static ResultBean fail(String msg) {
        ResultBean bean = new ResultBean();
        bean.setSuccess(false);
        bean.setMsg(msg);
        return bean;
    }
}
